<?php
function pbxtestsign()
	{
	$pubkeyfile = PAISEC.'pubkey.pem';
   $signature = $_GET['sign'];
   $b64decode = base64_decode(urldecode($signature));
   unset($_GET['sign']);
   unset($_GET['url']);
   
   $verifdata = ''; $prefix = '';
   foreach($_GET as $key => $value )
   	{
   	$verifdata .= $prefix . $key . '=' . $value;
   	$prefix = '&';
   	}

   $fp = fopen($pubkeyfile,"r");
   $certificat = fread($fp,filesize($pubkeyfile));
   $clepublic = openssl_pkey_get_public($certificat);
   
   TRACE($verifdata);
   TRACE($b64decode);
   TRACE($clepublic);

   return openssl_verify($verifdata,$b64decode,$clepublic);
	}
?>